/*
 * Copyright 2011 Clean GWT
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.cleangwt.showcase.client.page;

import com.cleangwt.bootstrap.client.ui.TabPanel;
import com.cleangwt.page.client.PageContext.CodeSplit;
import com.cleangwt.page.client.PageContext.Page;
import com.cleangwt.page.client.PageContext.Prefetch;
import com.cleangwt.showcase.client.activity.CwShoppingCart;
import com.cleangwt.showcase.client.activity.CwShoppingPayup;
import com.cleangwt.showcase.client.component.ShowcasePage;
import com.cleangwt.showcase.client.resource.PageGroups;
import com.cleangwt.showcase.client.resource.i18n.ShoppingManagerMessages;
import com.cleangwt.showcase.client.resource.i18n.ShowcaseMessages;
import com.cleangwt.user.client.activity.ActivityManager;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.LazyPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * @author Jess
 * @version 1.0
 * @since 1.0
 */
@Prefetch(PageGroups.FLOWCONTROL)
@CodeSplit
@Page
public class ShoppingCart extends ShowcasePage {
  ShoppingManagerMessages c = GWT.create(ShoppingManagerMessages.class);
  TabPanel tabPanel = new TabPanel();
  ActivityManager manager = new ActivityManager(tabPanel);

  public ShoppingCart() {
    super(ShowcaseMessages.Impl.shoppingcart(), "",
        "ShoppingCart.java CwShoppingCart.java CwShoppingPayup.java");
    tabPanel.add(new CwShoppingCart(), c.shoppingcart());
    tabPanel.add(new LazyPanel() {

      @Override
      protected Widget createWidget() {
        return new CwShoppingPayup();
      }
    }, c.payup());

    manager.setActive(0);
    setContentWidget(tabPanel);
  }

}
